package com.atguigu.spzx.product.controller;


import com.atguigu.spzx.model.pojo.product.Category;
import com.atguigu.spzx.model.vo.common.Result;
import com.atguigu.spzx.product.service.CategoryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Tag(name = "分类管理")
@RequestMapping("api/product/category")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    @GetMapping("/findCategoryTree")
    @Operation(summary = "查询分类树")
    public Result<List<Category>> findCategoryTree(){
        return Result.ok(categoryService.findCategoryTree());
    }

}
